package me.yushuai.wukong.base.repository;

import me.yushuai.wukong.base.entity.Zone;
import me.yushuai.wukong.common.persistence.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * 针对表【BAS_ZONE(库区)】的数据库操作Mapper
 *
 * @author zhoushuai@189.cn
 * @since 2022-08-25
 */
@Repository
public interface ZoneRepository extends BaseRepository<Zone, Long> {

    @Query("from Zone where bizId = ?1")
    Optional<Zone> findByBizId(String bizId);

    @Query("from Zone where bizId = ?1")
    boolean existsByBizId(String bizId);

    @Query("from Zone where  zoneId = ?1 and bizId = ?2")
    boolean existsByZoneIdAndBizId(Long zoneId, String bizId);
}




